﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class 障碍方块 : MonoBehaviour
{
    public int m_所需点数 = 10;
    public TextMesh m_数字文本;
    public GameObject m_撞击后消失对象;
    public GameObject m_撞击后特效;
    public int m_所在行 = 0;
    public int m_所在列 = 0;
     
    void Start ()
    {
        this.tag = "障碍";

        setText();
    }

    void setText(string text =null)
    {
        if (text != null)
        {
            m_数字文本.text = text;
        }
        else
        {
            if (m_所需点数 > 500)
            {
                m_数字文本.text = "◎";
            }
            else
            {
                m_数字文本.text = m_所需点数.ToString();
            }
        }
    }
	

	void Update ()
    {
        setText();

        if (地图管理器.m_当前地图管理器.m_玩家当前所在行 - m_所在行 > 10)
        {
            Destroy(this.gameObject);
        }
    }

}
